<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	  xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>登录</title>
		<link rel="stylesheet" href="/plugins/layui_v2/css/layui.css" media="all" />
		<link rel="stylesheet" href="/css/login.css" />
	</head>

	<body class="beg-login-bg">
		<div class="beg-login-box">
			<header>
				<h1>后台登录</h1>
			</header>
			<div class="beg-login-main">
				<form action="#" class="layui-form" method="post">
					<!--<input name="__RequestVerificationToken" type="hidden" value="fkfh8D89BFqTdrE2iiSdG_L781RSRtdWOH411poVUWhxzA5MzI8es07g6KPYQh9Log-xf84pIR2RIAEkOokZL3Ee3UKmX0Jc8bW8jOdhqo81" />-->
					<div class="layui-form-item">
						<label class="beg-login-icon">
                        <i class="layui-icon">&#xe612;</i>
                    </label>
						<input type="text" name="username" id="username" lay-verify="required" autocomplete="off" placeholder="这里输入登录名" class="layui-input">
					</div>
					<div class="layui-form-item">
						<label class="beg-login-icon">
                        <i class="layui-icon">&#xe642;</i>
                    </label>
						<input type="password" name="password" id="password" lay-verify="required" autocomplete="off" placeholder="这里输入密码" class="layui-input">
					</div>
					<div class="layui-form-item">
						<img class="beg-pull-right" src="/getGifCode" >
						<div class="beg-pull-left" style="width: 100px;">
							<input type="text" name="vcode" id="vcode" lay-verify="required" autocomplete="off" placeholder="验证码" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="beg-pull-left beg-login-remember">
							<label>记住帐号？</label>
							<input type="checkbox" name="rememberMe" value="true" lay-skin="switch" checked title="记住帐号">
						</div>
						<div class="beg-pull-right">
							<button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
                            <i class="layui-icon">&#xe650;</i> 登录
                        </button>
						</div>
						<div class="beg-clear"></div>
					</div>
				</form>
			</div>
		</div>
		<script type="text/javascript" src="/plugins/layui_v2/layui.js"></script>
		<script>

            layui.config({
                base : "/js/"
            }).use(['form','layer','jquery'], function () {
                var $ = layui.jquery,
                    form = layui.form,
                    common = layui.common,
                    carousel = layui.carousel;

                //监听提交
                form.on('submit(login)',function(data){
                    $.ajax({
                        type : "POST",
                        data : data.field,
                        dataType : "json",
                        url : "/ajaxLogin",
                        success : function(result) {
                            if (result.status != 200) {
                                location.href = "/login";
                            } else {
                                location.href = "/index";
                            }
                        }
                    });
                    return false;
                });
            });

		</script>
	</body>

</html>